
using UnityEngine;

namespace Enemy
{
    public class AttackState : IState
    {
        public AttackState(FSM manager)
        {
            this.manager = manager;
            this.parameter = manager.parameter;
        }
        public override void OnEnter()
        {
            parameter.animator.Play("Attack");
            parameter.rb.velocity = Vector2.zero;
        }

        public override void OnUpdate()
        {
            if (parameter.isHurt)
            {
                manager.TransitionState(StateType.Hit);
            }
            if (parameter.animatorStateInfo.normalizedTime >= .95f)
            {
                manager.TransitionState(StateType.Chase);
            }
        }

        public override void OnFixedUpdate() { }

        public override void OnExit() { }
    }
}
